using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.InteropServices;

using ILRuntime.CLR.TypeSystem;
using ILRuntime.CLR.Method;
using ILRuntime.Runtime.Enviorment;
using ILRuntime.Runtime.Intepreter;
using ILRuntime.Runtime.Stack;
using ILRuntime.Reflection;
using ILRuntime.CLR.Utils;
using System.Linq;

namespace ILRuntime.Runtime.Generated
{
    unsafe class huqiang_Data_Record_Binding
    {
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase method;
            FieldInfo field;
            Type[] args;
            Type type = typeof(huqiang.Data.Record);

            field = type.GetField("tag", flag);
            app.RegisterCLRFieldGetter(field, get_tag_0);
            app.RegisterCLRFieldSetter(field, set_tag_0);
            app.RegisterCLRFieldBinding(field, CopyToStack_tag_0, AssignFromStack_tag_0);
            field = type.GetField("data", flag);
            app.RegisterCLRFieldGetter(field, get_data_1);
            app.RegisterCLRFieldSetter(field, set_data_1);
            app.RegisterCLRFieldBinding(field, CopyToStack_data_1, AssignFromStack_data_1);


            app.RegisterCLRCreateDefaultInstance(type, () => new huqiang.Data.Record());
            app.RegisterCLRCreateArrayInstance(type, s => new huqiang.Data.Record[s]);

            args = new Type[]{};
            method = type.GetConstructor(flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Ctor_0);

        }



        static object get_tag_0(ref object o)
        {
            return ((huqiang.Data.Record)o).tag;
        }

        static StackObject* CopyToStack_tag_0(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Data.Record)o).tag;
            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value = result_of_this_method;
            return __ret + 1;
        }

        static void set_tag_0(ref object o, object v)
        {
            ((huqiang.Data.Record)o).tag = (System.Int32)v;
        }

        static StackObject* AssignFromStack_tag_0(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Int32 @tag = ptr_of_this_method->Value;
            ((huqiang.Data.Record)o).tag = @tag;
            return ptr_of_this_method;
        }

        static object get_data_1(ref object o)
        {
            return ((huqiang.Data.Record)o).data;
        }

        static StackObject* CopyToStack_data_1(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Data.Record)o).data;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_data_1(ref object o, object v)
        {
            ((huqiang.Data.Record)o).data = (System.String)v;
        }

        static StackObject* AssignFromStack_data_1(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.String @data = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            ((huqiang.Data.Record)o).data = @data;
            return ptr_of_this_method;
        }



        static StackObject* Ctor_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* __ret = ILIntepreter.Minus(__esp, 0);

            var result_of_this_method = new huqiang.Data.Record();

            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }


    }
}
